package dashboard.controller;

import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import dashboard.domain.Member;
import dashboard.service.MemberManagerService;

@Controller
public class MemberController{

	protected Log log = LogFactory.getLog(getClass());
	
	@Autowired
	private MemberManagerService memberService;
	
	@RequestMapping(method = RequestMethod.GET)
	public ModelAndView listAllMembers(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, Exception{
		
		List<Member> members = memberService.listAllMembers();
		
		return new ModelAndView("member", "members", members);
	}
}
